class Solution1 {
    public static int numberOfArithmeticSlices(int[] nums) {
        int len=nums.length;
        if(len<3) {
            return 0;
        }
        int count=0;
        boolean flag=true;
        for(int i=1;i<len-1;i++) {
            if(nums[i]-nums[i-1]==nums[i+1]-nums[i]) {
                count++;
                continue;
            }
            flag=false;
        }
        return flag==true?count+1:count;
    }

    public static void main(String[] args) {
        int[] nums={1,2,3,4};
        System.out.println(numberOfArithmeticSlices(nums));
    }
}
public class lc413 {
}
